package com.heima.admin.controller;

import com.heima.api.wemedia.WemediaClient;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.WmChannelDto;
import com.heima.model.wemedia.pojos.WmChannel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class AdChannelController {
    @Autowired
    private WemediaClient wemediaClient;
    @GetMapping("/api/v1/channel/del/{id}")
    public ResponseResult deletea(@PathVariable Integer id) {
        ResponseResult deletea = wemediaClient.deletea(id);
        return deletea;
    }

    @PostMapping("/api/v1/channel/list")
    public ResponseResult list(@RequestBody WmChannelDto dto) {
        ResponseResult list = wemediaClient.list(dto);
        return list;
    }

    @PostMapping("/api/v1/channel/save")
    public ResponseResult save(@RequestBody WmChannel wmChannel) {
        ResponseResult save = wemediaClient.save(wmChannel);
        return save;
    }

    @PostMapping("/api/v1/channel/update")
    public ResponseResult update(@RequestBody WmChannel wmChannel) {
        ResponseResult update = wemediaClient.update(wmChannel);
        return update;
    }
}
